using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using Evaluant.Uss.ObjectContext;

namespace NUnit.MappingGenerator
{
    public class TestMappingGeneratorFromAssembly : TestMappingGenerator
    {
        public override void Configure()
        {
            if (File.Exists("Model.eum.xml"))
                File.Delete("Model.eum.xml");

            //  Generate Mapping File
            Process p = new Process();
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = @"..\..\..\MappingGenerator\bin\debug\Mapping.exe";
            psi.Arguments = @"/assembly:..\..\..\NUnit\bin\debug\NUnit.dll /out:..\..\..\NUnit\bin\debug\Model.eum.xml";
            psi.CreateNoWindow = false;

            p.StartInfo = psi;

            p.Start();

            p.WaitForExit();

            ObjectService os = new ObjectService(Path.GetDirectoryName(typeof(TestMappingGenerator).Assembly.Location) + "\\engines.config", "MappingGenerator");
            oc = os.CreateObjectContext();
        }

    }
}
